﻿<!DOCTYPE HTML>
<html>
{include file="public:header_css"}
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 投票管理 <span class="c-gray en">&gt;</span> 投票活动
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
	<div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a class="btn btn-primary radius" href="{:url('add')}">
				<i class="Hui-iconfont">&#xe600;</i> 新增活动
			</a>
		</span>
		<span class="r">共有：<strong>{$total}</strong> 条</span>
	</div>
	<form class="form-inline" role="form" method="get">
		<div id="" class="" style="float: right;margin-top: 20px;margin-bottom: 20px;">
			<label>标题查找:
				<input type="search" class="input-text " value="{$title ? $title : '';}" style="width: 200px;" name="keywords" id="keywords" >
				<button class="btn btn-primary radius" type="submit" id="submit"  style="margin-top: -4px;">&nbsp;&nbsp;搜索&nbsp;&nbsp;</button>
				<button class="btn btn-warning radius" type="submit" id="reset"  style="margin-top: -4px;">&nbsp;&nbsp;置空&nbsp;&nbsp;</button>
			</label>
		</div>
	</form>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-sort">
			<thead>
			<tr class="text-c">
				<th width="60">活动ID</th>
				<th width="100">标题</th>
				<th width="100">图片logo</th>
				<th width="100">开始时间</th>
				<th width="100">结束时间</th>
				<th width="70">活动总票限制</th>
				<th width="70">每人总票限制</th>
				<th width="70">每人每日限制</th>
				<th width="180">操作</th>
			</tr>
			</thead>
			<tbody id="voteActList">
			{foreach name="list" item="val" key="key"}
			<tr class="text-c">
				<td>{$val['id']}</td>
				<td>{$val['title']}</td>
				<td><img width="80" class="picture-thumb" src="{$val.pic_url}"></td>
				<td>{$val['start_time']|date='Y-m-d',###}</td>
				<td>{$val['end_time']|date='Y-m-d',###}</td>
				<td>{$val['vote_limit']}次</td>
				<td>{$val['total_limit']}次</td>
				<td>{$val['day_limit']}次</td>
				<td class="f-14 product-brand-manage" id="use">
					<a class="label label-secondary radius" href="{:url('edit',array('id'=>$val['id']))}">编辑</a>
					<a class="label label-secondary radius" href="{:url('act_recode',array('act_id'=>$val['id']))}">投票记录</a>
					<a class="label label-secondary radius"  onClick="del('{$val.id}')">删除</a>
                    {if $val['status'] == 0}
                    <span class="label label-success radius">进行中</span>
                    {else /}
                    <span class="label radius">已结束</span>
                    {/if}
				</td>
			</tr>
			{/foreach}
			{if count($list)<=0 }
			<tr class="text-c">
				<td colspan="9">
					暂无数据
				</td>
			</tr>
			{/if}
			</tbody>
		</table>
	</div>
	{$page}
</div>

{include file="public:footer_js"}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/laypage/1.2/laypage.js"></script>

<script type="text/javascript">
    //重置
    $('#reset').click(function () {
        $('#keywords').val('');
    })
    //软删除
    function del(id)
    {
        var notice = "确认删除吗？";
        layer.confirm(notice,function () {
            $.post(
                '{:url("del")}',
                {
                    is_del: 1,
                    id : id
                },
                function (res) {
                    if(res.code === 1){
                        layer.msg("删除成功",{icon:6,time:1000});
                        setTimeout(function () {
                            location.replace(location.href);
                        },2000);

                    }else{
                        layer.msg(res.msg,{icon:5,time:1000});
                    }
                }
            );
        });
    }
</script>
</body>
</html>